package com.qqt.csr.common.session;

import com.google.common.collect.Maps;
import com.qqt.csr.common.vo.req.RequestHeader;

import java.util.Map;

/**
 * @ClassName: SessionContextHolder
 * @Description: 应用上下文线程会话保存工具
 */
public class SessionContextHolder extends BaseThreadLocal{

    public static void setHeaderInfo(RequestHeader headerInfo) {
        set(RequestHeader.HEADER_INFO, headerInfo);
    }

    public static RequestHeader getHeaderInfo() {
        return getObject(RequestHeader.HEADER_INFO, RequestHeader.class);
    }

    public static Map<String, String> getExtraMap() {
        Map map = getObject(RequestHeader.EXTRA_MAP, Map.class);
        return map == null ? Maps.newHashMap() : (Map<String, String>) map;
    }

    public static void clear() {
        remove();
    }


}
